const https = require('https');
const cheerio = require('cheerio');


let urls = [];

https.get('https://www.tupianzj.com/meinv/mm/', (res) => {
  res.setEncoding('utf8');
  let rawData = '';
  res.on('data', (chunk) => {
    console.log("数据过来啦");
    rawData += chunk;
  });
  res.on('end', () => {
    const $ = cheerio.load(rawData)
    $('img').each((i,el)=>{
      urls.push( $(el).attr('src') );
    })
    console.log(urls);
  });
}).on('error', (e) => {
  console.error(`出现错误: ${e.message}`);
});